package com.sunsy.authserver.wrapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.hutool.core.bean.BeanUtil;
import com.sunsy.authserver.beans.dto.UserTenantRelationDTO;
import com.sunsy.authserver.beans.po.UserTenantRelation;
import com.sunsy.authserver.beans.vo.UserTenantRelationVO;

/**
 * (UserTenantRelation)表包装类
 *
 * @author makejava
 * @since 2021-07-20 14:40:45
 */
public class UserTenantRelationWrapper extends AbstractWrapper<UserTenantRelation, UserTenantRelationVO, UserTenantRelationDTO>{

  public static UserTenantRelationWrapper build() {
    return new UserTenantRelationWrapper();
  }

  /**
   * dto转queryWrapper
   *
   * @param dto 交互数据
   * @return 查询Wrapper
   */
  @Override
  public QueryWrapper<UserTenantRelation> dto2QWrapper(UserTenantRelationDTO dto) {
    UserTenantRelation po = dto2PO(dto);
    return new QueryWrapper<>(po);
  }

  /**
   * dto转po
   *
   * @param dto 交互数据
   * @return UserTenantRelation 实体对象
   */
  @Override
  public UserTenantRelation dto2PO(UserTenantRelationDTO dto) {
    return BeanUtil.copyProperties(dto, UserTenantRelation.class);
  }

  /**
   * po转vo
   *
   * @param po 实体对象
   * @return UserTenantRelation 实体展示对象
   */
  @Override
  public UserTenantRelationVO po2VO(UserTenantRelation po) {
    return BeanUtil.copyProperties(po, UserTenantRelationVO.class);
  }

}